package com.acme.task4;

import java.util.Arrays;
import java.util.Formatter;

public class Task4Arrays {
	public static void main(String[] args) {

		int[] numbersToSearch = new int[] { 3,7,9 }; 
		int[] array = new int[]{ 3,7,3,9,3,9,7,7,7,9 };
		
		int numbersToSearchLength = numbersToSearch.length;
		int arrayLength = array.length;
				
		Arrays.sort(array);
		for(int i = 0, j = 0, count = 0; i < numbersToSearchLength; i++, count = 0) {
			while(j < arrayLength && array[j] == numbersToSearch[i]){
				count++;
				j++;
			}
			Formatter fmt = new Formatter();
			System.out.println(fmt.format("Number of %d: %d", numbersToSearch[i], count));
			fmt.close();
		}
	}
}
